package org.lgiavedoni.android.franq.command.general;

import java.util.ArrayList;

import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.Options;
import org.lgiavedoni.android.franq.core.command.Command;
import org.lgiavedoni.android.franq.service.communication.CommunicationService;
import org.lgiavedoni.android.franq.util.collection.CollectionUtils;
import org.lgiavedoni.android.franq.util.phone.voice.VoiceReceiver;
import org.lgiavedoni.android.franq.util.phone.voice.VoiceRecognition;

public class RecognitionCommand extends Command implements VoiceReceiver {

	@Override
	public void setOptions(Options options) {
	}

	@Override
	public boolean execute(CommandLine cmd) throws Exception {
		VoiceRecognition.recognizeSpeech(this);
		return true;
	}

	@Override
	public String getCommandText() {
		return "recognition";
	}

	@Override
	public void result(ArrayList<String> recognize) {
		CommunicationService.inst.sendDefaultTextMessage(CollectionUtils.toString(recognize, " "));

	}
}